home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-11-03 | 2.4 KB | 56 lines | [TEXT/GEOL] |
- Item 5715992 3-Nov-89 06:25
-
- From: NOR0042 NOD Data Nostra
-
- To: SW0092 SWD Administrator System AB, Sthlm
-
- cc: MACAPP.TECH$ MacApp Technical
-
- Sub: RE- USES problems
-
- Dear Kent,
-
- I too have USES problems, but I think I can answer your question.
-
- (1) The way the USES clause works is that the INTERFACE part of the units used
- are scanned in the same order as they appear in the USES clause.
-
- (2) Pascal has the general principle that an identifier must be declared
- before it can be used.
-
- So let us put (1) and (2) together. If our unit refers to an identifier from
- another unit in our INTERFACE part, then because of (1), not only we, but all
- clients who USE us, also have to USE the unit which the identifier stems from,
- and because of (2) its name must be mentioned first.
-
- If we restrict ourselves to mention the identifier in our IMPLEMENTATION part,
- our clients don't have to bother because only our INTERFACE part is read during
- their compilation.
-
- That was an explanation, not a solution of problems, and I too would like to
- see some good advice and rules of thumb. The above mentioned principles impose
- a tree-structure where procedures are high-level and low-level, and low-level
- procedures have no knowledge about their high-level clients. This hierachial
- design is good in a procedurally oriented design, but is it necessarily true
- with objects? Two objects which happen to know each other, directly or
- indirectly, should they be put in the same unit? Or should we absolutely avoid
- such circular references? I struggle to make good object oriented design, and
- often I perceive the strict USES principles as a severe limitation.
-
- The problem arises frequently when an object has another object as a field and
- therefore needs its classname in the INTERFACE part. An alternative is to give
- the field a more general type from which it inherits and typecast when new
- methods are called because "we know" that these methods are present. But
- object casting should not be done regularly, or should it?
-
- There are also some technical questions involved. In a complicated program the
- compiler (3.0) may refuse to recognize some objects, but when I MABuild with
- "-Pascal -clean" option, everything works fine, but slow of course, as the
- compiler has to read the text directly instead of symbol tables.
-
- Sigmund Tveit
- Data Nostra A/S
- Oslo, Norway
-
-
-